package net.sx.minemodule.mvp.activities;

import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.aroutercomment.UserService;
import com.kedll.library.base.MyBaseFragmentActivity;
import com.kedll.library.mvp.BasePresenter;

import net.sx.minemodule.R;
import net.sx.minemodule.databinding.MineActivityUpdateNickNameBinding;
import net.sx.minemodule.mvp.presenters.MineUpdateNickNamePresenters;
import net.sx.minemodule.mvp.views.MineUpdateNickNameView;

/**
 * 修改昵称
 *
 * @author 11470
 */
@Route(path = ARouterPath.PATH_MINE_SETTING_USER_INFO_UPDATE_NICK_NAME)
public class MineUpdateNickNameActivity extends MyBaseFragmentActivity<MineActivityUpdateNickNameBinding, MineUpdateNickNamePresenters> implements MineUpdateNickNameView {
    @Autowired(name = ARouterPath.PATH_USER_SERVICE)
    public UserService userService;

    @Override
    protected int getLayout() {
        return R.layout.mine_activity_update_nick_name;
    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        mBinding.setUpdatenick(mPresenter);
    }

    @Override
    protected void initToolBar(Bundle savedInstanceState) {
        super.initToolBar(savedInstanceState);
        ARouter.getInstance().inject(this);
        setTitle("修改昵称");
    }

    @Override
    protected MineUpdateNickNamePresenters getPresenter() {
        return new MineUpdateNickNamePresenters(this);
    }

    @Override
    public void updaterSuccessView(String newName) {
        userService.setNiName(newName);
        finish();
    }
}
